#include <iostream>
#include <array>

using namespace std;

template <typename T, size_t N1, size_t N2>
T sum_2_array(array<T, N1> arr, array<T, N2> arr2)
{
    T a;
    for (int i=0; i<N1; i++)
    {
        a += arr[i];
    }

    T b;
    for (int i=0; i<N2; i++)
    {
        b += arr2[i];
    }
    return a+b;
}

template <typename T, size_t N>
void displayArray(array<T, N> arr)
{
    cout << "[";
    for (int i=0; i<N; i++)
    {
        cout << arr[i];
        if (i < N-1)
        {
            cout << ",";
        }
    }
    cout << "]";
    cout << endl;
}

int main()
{
    array<double, 10> arr = {1.0, 2, 3, 4, 5, 6, 7, 8};
    array<double, 10> arr2 = {1.0, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    displayArray(arr);
    displayArray(arr2);
    cout << sum_2_array(arr, arr2) << endl;
    return 0;
}